package PatientManagement

import (
	"MedicalTreatment/global"
	"MedicalTreatment/model"
	"fmt"
	"github.com/gin-gonic/gin"
)

func UpdatePat(r *gin.Engine) {
	r.POST("/updatePat", func(context *gin.Context) {
		var pat model.Patient
		if err := context.ShouldBindJSON(&pat); err != nil {
			context.JSON(200, gin.H{
				"Msg": err,
			})
		} else {
			if err := global.DB.Where("id", pat.ID).Updates(&pat).Error; err != nil {
				context.JSON(200, gin.H{
					"Msg": err,
				})
			} else {
				fmt.Println("哥哥沙比")
				context.JSON(200, gin.H{
					"Msg": "修改成功",
				})
				fmt.Println("哥哥大沙比")

			}
		}

	})
}
